/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cc.altius.web.controller;

import cc.altius.service.CustomerService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * @author sagar
 */
@Controller
public class SearchCustomerController {

    @Autowired
    private CustomerService customerService;

    @RequestMapping(value = "/customer/searchCustomerCommonHeader.htm", method = RequestMethod.GET)
    public String showSearchCustomerGetPage() {

        return "customer/searchCustomerCommonHeader";
    }

    @RequestMapping(value = "/customer/searchCustomerCommonHeader.htm", method = RequestMethod.POST)
    public String showSearchCustomerPostPage(
            @RequestParam(value = "mrNo1", required = false, defaultValue = "") String mrNo1,
            @RequestParam(value = "phone", required = false, defaultValue = "") String phone,
            @RequestParam(value = "customerName1", required = false, defaultValue = "") String customerName1,
            @RequestParam(value = "empId1", required = false, defaultValue = "") String empId1,
            ModelMap modelMap) {

        List<Map<String, Object>> customerlist = this.customerService.searchCustomer(mrNo1, phone, customerName1, empId1);
        modelMap.addAttribute("customerlist", customerlist);

        return "customer/searchCustomerCommonHeader";
    }
}
